package com.qing.demo.netty.demo1.aio.client;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.charset.Charset;
import java.util.concurrent.Future;

/**
 * @author caozhipeng
 * @date 2025/7/22
 */
public class AioClient {
    public static void main(String[] args) throws Exception {
        AsynchronousSocketChannel socketChannel=AsynchronousSocketChannel.open();
        Future<Void> future=socketChannel.connect(new InetSocketAddress("127.0.0.1",7379));
        System.out.println("开始AIO的学习。。。。。。。");
        future.get();
        socketChannel.read(ByteBuffer.allocate(1024),null,new AioClientHandler(socketChannel, Charset.forName("utf-8")));
        Thread.sleep(1000000);

    }
}
